package thread.thread2;

public class MyThread extends Thread {
	public MyThread(String name) {
		super(name);
	}

	@Override
	public void run() {
		for (int i = 0; i < 30; i++) {
			System.out.println(Thread.currentThread().getName() + ":" + i);
			yield();
		}
	}

	public static void main(String[] args) {
		System.out.println(Thread.currentThread().getName());
		// for (int i = 1; i <= 3; i++) {
		// new MyThread("线程" + i).start();
		// }
		MyThread t1 = new MyThread("线程1");
		t1.setPriority(MAX_PRIORITY);
		t1.start();
		MyThread t2 = new MyThread("线程2");
		t2.setPriority(MIN_PRIORITY);
		t2.start();
		MyThread t3 = new MyThread("线程3");
		t3.setPriority(NORM_PRIORITY);
		t3.start();
	}

}
